package com.tairanchina.wiki.api.model.wiki.content;

import com.tairanchina.wiki.api.TextBuilder;

/**
 * Created by 周靖捷 on 2016/10/4.
 */
public abstract class AbstractPageFragment<T extends AbstractPageFragment> implements ProjectPageFragment {
    String title;

    @Override
    public String getTitle() {
        return title;
    }

    public T setTitle(String title) {
        this.title = title;
        return (T) this;
    }

    @Override
    public abstract String getContent();

    @Override
    public String toMarkdown() {
        TextBuilder tBuilder = new TextBuilder();
        tBuilder.writeln(getTitle())
                .writeln("----")
                .writeln(getContent());
        return tBuilder.build();
    }
}
